package com.study.dubbo.provider.service;

import com.alibaba.dubbo.config.annotation.Service;
import com.study.dubbo.bean.UserAddress;
import com.study.dubbo.service.UserService;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;


/**
 * Created on 2019/8/22.
 *
 * @author Grak
 * @since 1.0
 */
//这个是dubbo的注解
@Service(loadbalance = "roundrobin",weight = 100)
@Component
public class UserServiceImpl implements UserService {

    @Override
    public List<UserAddress> getUserAddress(long playerId) {
        List<UserAddress> userAddresses = new ArrayList<>();
        for(int i = 0;i< 5;i++){
            UserAddress address = new UserAddress();
            address.setAge(i + 1);
            address.setAddress("秋名山" + (i + 3) * 7 +"号公路");
            address.setName("1111" + i);
            userAddresses.add(address);
        }
        return userAddresses;
    }
}
